package dk.ahp.helloworld;

import android.os.Bundle;
import android.app.Activity;
import android.text.Editable;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class MainActivity extends Activity implements OnClickListener {
	private TextView tv;
	private Button knap;
	private EditText editText;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        tv = (TextView) findViewById(R.id.textview);
        knap = (Button) findViewById(R.id.button1);
        editText = (EditText) findViewById(R.id.editText1);
        knap.setOnClickListener(this);
        tv.setOnClickListener(this);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }
    
    public void onClick(View v)
    {
    	if (v == knap)
    	{
    		Editable a = editText.getText();
    		
    		knap.setText(a.toString());
    	}
    	if (v == tv)
    	{
    		tv.setText("Ramte ikke knappen");
    	}
    }
    }
